<?php

namespace App\Model;

use App\User;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Model\UserInterPushRecord
 *
 * @mixin \Eloquent
 * @property int $id
 * @property int|null $user_id 主动匹配用户的user->id
 * @property int|null $material_id 主动匹配用户对应的素材user_interpush_record_material->id
 * @property int|null $is_share 0，未分享， 1分享，
 * @property string|null $share_time 分享时间
 * @property int|null $target_user_id 被匹配用户users->id
 * @property int|null $target_meterial_id 被匹配用户素材_user_interpush_record_material->id
 * @property int|null $target_is_share 0，未分享， 1分享，
 * @property string|null $target_share_time 被动分享时间
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereIsShare($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereMaterialId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereShareTime($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereTargetIsShare($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereTargetMeterialId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereTargetShareTime($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereTargetUserId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereUserId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord query()
 * @property-read \App\User|null $passiveUser
 * @property-read \App\User|null $user
 * @property int|null $meterial_id 匹配用户素材_user_interpush_record_material->id
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereMeterialId($value)
 * @property int|null $interpush_id 主动匹配用户的interpush>id
 * @property int|null $target_interpush_id 被匹配用户interpush>id
 * @property-read \App\Model\UserInterPushRecordMaterial $interPushRecordMaterials
 * @property-read \App\Model\UserInterPushRecordMaterial $passiveInterPushRecordMaterials
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereInterpushId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecord whereTargetInterpushId($value)
 */
class UserInterPushRecord extends Model
{
    protected $table = "user_interpush_record";

    /**
     * 主动素材
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function interPushRecordMaterials()
    {
        return $this->hasOne(UserInterPushRecordMaterial::class,"id", "meterial_id");
    }

    /**
     * 被动素材
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function passiveInterPushRecordMaterials()
    {
        return $this->hasOne(UserInterPushRecordMaterial::class,"id", "target_meterial_id");
    }

}
